﻿using System.Collections.Generic;
using NUnit.Framework;

namespace PriceCalculator.Tests
{
  [TestFixture]
  class CollectSerie
  {
    [Test]
    public void Test1()
    {
      var numberOfBbooksCounter = new[] {1, 1, 1, 1, 1};

      var numberOfBooksInASerie = new List<int>();
      var result = Calculator.CollectSerie(numberOfBbooksCounter, numberOfBooksInASerie);

      Assert.That(result, Is.EqualTo(false));
      Assert.That(numberOfBbooksCounter, Is.EqualTo(new[] {0, 0, 0, 0, 0}));
      Assert.That(numberOfBooksInASerie, Is.EqualTo(new List<int>{5}));
    }

    [Test]
    public void Test2()
    {
      var numberOfBbooksCounter = new[] { 1, 2, 1, 1, 1 };

      var numberOfBooksInASerie = new List<int>();
      var result = Calculator.CollectSerie(numberOfBbooksCounter, numberOfBooksInASerie);

      Assert.That(result, Is.EqualTo(false));
      Assert.That(numberOfBbooksCounter, Is.EqualTo(new[] { 0, 1, 0, 0, 0 }));
      Assert.That(numberOfBooksInASerie, Is.EqualTo(new List<int> { 5 }));
    }

    [Test]
    public void TestNoBooks()
    {
      var numberOfBbooksCounter = new[] { 0, 0, 0, 0, 0 };

      var numberOfBooksInASerie = new List<int>();
      var result = Calculator.CollectSerie(numberOfBbooksCounter, numberOfBooksInASerie);

      Assert.That(result, Is.EqualTo(true));
    }
  }
}
